package com.yixing.tech.common.base;


import com.yixing.tech.common.enums.ErrCode;

/**
 * @author yixing tech
 */
public class BusinessException extends Exception {
    private int errorCode;
    private int rpcCode;

    private Object msg;

    public Object getMsg() {
        return msg;
    }

    public void setMsg(Object msg) {
        this.msg = msg;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public BusinessException(ErrCode errorCode) {
        super();
        this.errorCode = errorCode.getCode();
    }

    public BusinessException(int rpcCode) {
        super();
        this.rpcCode = rpcCode;
    }

    public BusinessException(ErrCode errorCode, Object message) {
        super(message == null?"":message.toString());
        this.errorCode = errorCode.getCode();
        this.msg = message;
    }
    public BusinessException(int code, Object message) {
        super(message == null?"":message.toString());
        this.errorCode = code;
        this.msg = message;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);

    }

    public BusinessException(String message) {
        super(message);
        this.msg = message;
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public int getRpcCode() {
        return rpcCode;
    }

    public void setRpcCode(int rpcCode) {
        this.rpcCode = rpcCode;
    }
}
